/**
 * Net post get  ajax
 * url 路径
 * param 参数
 *iCallBack 回调函数
 */
var Net = {
    post: function (url, param, iCallBack) {
        var thus = this;

        $.post(url, param, function (result) {
            thus.successResult(result, iCallBack);
        });
    },
    get: function (url, iCallBack) {
        this.post(url, "", iCallBack);
    },

    ajax: function (url, formData, iCallBack) {
        var thus = this;
        $.ajax({
            url: url,
            type: "post",
            async: false,
            data: formData,
            cache: false,
            contentType: false,
            processData: false,
            success: function (result) {
                thus.successResult(result, iCallBack);
            },
            error: function (jqXHR, textStatus, errorThrown) {
                toastr.warning("发生未知错误，请稍候重试");
            }
        });
    },
    successResult: function (result, iCallBack) {
        if (result.code === 0) {
            if (result.msg !== "" && result.msg == null)//成功 只提示
                toastr.success(result.msg);

            iCallBack((result.data));//不是json时转换层json
        }
        else
            toastr.warning(result.Content);

    }

};